package com.huaxin.hxmoduleworkorder.dto.request;

import com.huaxin.hxenum.validation.ValidUnit;
import com.huaxin.hxmoduleworkorder.common.annotation.validation.ValidCustomerType;
import com.huaxin.hxmoduleworkorder.common.annotation.validation.ValidInspectionTemplateItemCategory;
import com.huaxin.hxmoduleworkorder.common.annotation.validation.ValidInspectionTemplateItemEquipmentType;
import com.huaxin.hxmoduleworkorder.common.annotation.validation.ValidInspectionTemplateItemType;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

/**
 * 新增巡查模板项请求 DTO
 * <p>
 * 对应实体类：InspectionTemplateItem
 * 用于接收前端提交的巡查模板检查项创建数据。
 * 所有字段命名与实体类完全一致，确保映射准确。
 * 使用 jakarta.validation 进行参数校验。
 * </p>
 *
 * @author [你的名字或团队]
 * @since 2025-09-02
 */
@Data
public class InspectionTemplateItemCreateReqDTO {
    @Schema(description = "编码，唯一标识", example = "ELEC_001")
    @NotBlank(message = "检查项编码不能为空")
    @Size(max = 50, message = "编码长度不能超过50个字符")
    private String code;

    @Schema(description = "名称", example = "电表读数是否正常")
    @NotBlank(message = "名称不能为空")
    @Size(max = 100, message = "名称长度不能超过100个字符")
    private String name;

    @Schema(description = "类型：check（检查）/measure（测量）/photo（拍照）/text（文本填写）", example = "photo")
    @NotBlank(message = "类型不能为空")
    @ValidInspectionTemplateItemType
    private String type;

    @Schema(description = "标准值或规范说明", example = "220V±5%")
    @Size(max = 200, message = "标准值长度不能超过200个字符")
    private String standardValue;

    @Schema(description = "单位", example = "V")
    @Size(max = 20, message = "单位长度不能超过20个字符")
    @ValidUnit
    private String unit;

    @Schema(description = "填写提示，指导用户如何填写", example = "请拍摄电表当前读数照片")
    @Size(max = 500, message = "填写提示长度不能超过500个字符")
    private String inputHint;

    @Schema(description = "所属类别：electrical_safety/equipment_operation/environmental_inspection", example = "electrical_safety")
    @ValidInspectionTemplateItemCategory
    private String category;

    @Schema(description = "适用设备类型：switchboard/transformer/cable/motor/generator/control_panel", example = "switchboard")
    @ValidInspectionTemplateItemEquipmentType
    private String equipmentType;

    @Schema(description = "适用客户类型：commercial/industrial/residential", example = "commercial")
    @ValidCustomerType
    private String customerType;

    @Schema(description = "排序序号，用于前端展示顺序", example = "1")
    private Integer sortOrder;

    @Schema(description = "是否必填：0-否，1-是", example = "1")
    @NotNull(message = "是否必填字段不能为空")
    private Integer isRequired;
}